

package jetbrains.buildServer.server.rest.data.locator;

import java.util.Collection;
import java.util.stream.Collectors;
import jetbrains.buildServer.server.rest.data.locator.definition.LocatorDefinition;
import jetbrains.buildServer.server.rest.data.locator.definition.LocatorDefinitionUtil;
import org.jetbrains.annotations.NotNull;

public class SubDimensionSyntaxImpl implements SubDimensionSyntax {
  private final Class<? extends LocatorDefinition> myDefenitions;

  public SubDimensionSyntaxImpl(@NotNull Class<? extends LocatorDefinition> definitions) {
    myDefenitions = definitions;
  }

  @Override
  public Collection<Dimension> getSubDimensions() {
    return LocatorDefinitionUtil.getAllDimensions(myDefenitions).collect(Collectors.toList());
  }

  @Override
  public String getFormat() {
    return myDefenitions.getSimpleName();
  }
}